﻿@{
    Layout = "../Shared/_Layout.cshtml";
    ViewBag.Title = "Index2";
}
<link href="~/Style/DMDefaultStyle.css" rel="stylesheet" />

<div id="topMenuBar">
    <div id="topMenuBarLinks">
        @Html.ActionLink("Back to Menu", "Index", "Menu")
    </div>
    <div class="borderHorizontal"></div>
</div>

<div id="editorDiv">
    <div class="leathery">
        <div id="editorButtonBar">
            <div id="editorCloseButton" class="closeButton"></div>
        </div>
    </div>
</div>

<!-- main area -->
    @if (Model.EncounterStarted)
    {
        <div class="leathery">
        <div class="borderHorizontal"></div>
        <div id="ActivePlayer" class="player">
            

            @{ var activePlayer = Model.InitiativePlayer(); }
            <div class="PlayerIcon"><img src="@Url.Content("~/Resources/ClassIcons/" + activePlayer.ClassIcon)" alt="@activePlayer.ClassIcon"/></div>
            <div class="playerName">
                @activePlayer.Name
                <span class="buttonIcon"><img src="../../Resources/bullet2.gif"/></span>
            </div>
            <div class="playerStatsSmall">
                <span class="playerHp">@activePlayer.CurrentHp<span>/</span>@activePlayer.MaxHp</span>
                <span class="playerInit">@activePlayer.Initiative</span>
            </div>
            <div class="playerDetails">
                Morde Details
            </div>
        </div>
        <div class="button">
            <a href="@Url.Action("EndPlayerTurn")">End turn</a>
        </div>
        <div id="inactivePlayers">
            @foreach (var player in Model.GetInactivePlayers())
            {
                if (!player.Active)
                {
                    @:<div class="player inactive">
                }
                else
                {
                    @:<div class="player">
                }

                <div class="PlayerIcon"><img src="@Url.Content("~/Resources/ClassIcons/" + player.ClassIcon)" alt="@player.ClassIcon"/></div>
                <div class="playerName">
                    @player.Name
                    <span class="buttonIcon"><img src="../../Resources/bullet2.gif"/></span>
                </div>
                <div class="playerStatsSmall">
                    <span class="playerHp">@player.CurrentHp<span>/</span>@player.MaxHp</span>
                    <span class="playerInit">@player.Initiative</span>
                </div>
                @:</div>
            }
                <div class="borderHorizontal"></div>
        </div>
     </div>   
    }
    
    <!-- Players -->

    <div class="borderHorizontal"></div>
        <div id="playerWrapper">
            @foreach (var player in Model.Players)
            {
                <div class="PlayerSquare 
                    @if(Model.EncounterStarted) 
                    {
                      if(player.Id == Model.InitiativePlayer().Id)
                      { 
                        @: PlayerSquareActive
                      }
                    } 
                    ">
                    <div class="playerNameSquare">@player.Name</div>
                    <div class="playerIconSquare"><img src="@Url.Content("~/Resources/ClassIcons/"+player.ClassIcon)" alt="@player.ClassIcon"/></div>
                </div>
            }
        </div>
    <div class="borderHorizontal"></div>

    <!-- Room -->       
    @if(!Model.EncounterStarted)
    {
        <div id="CurrentRoom">
            <div class="borderHorizontal"></div>
            <div id="CurrentRoomTitle">@Model.CurrentRoom.Name</div>
            <div class="borderHorizontal"></div>
            <div class="Description">
                <div id="CurrentRoomImage">
                    <img src="@Url.Content(contentPath: "~/Resources/Rooms/"+Model.CurrentRoom.RoomEnumToImage())" />
                </div>               
                <div id="CurrentRoomText">@Model.CurrentRoom.Description
                </div>
            </div>
            <div class="borderHorizontal"></div>
        </div>
        <div id="AllRooms">
            @foreach(var room in Model.Rooms)
            {
                <div class="scrollInner">
                    <div class="RoomSmall">
                        <a href="@Url.Action("ChangeRoom/"+room.Id)">
                            <div>@room.Name</div>
                            <div><img class="smallImage" src="@Url.Content(contentPath: "~/Resources/Rooms/"+room.RoomEnumToImage())" /></div>
                        </a>
                    </div>
                </div>
            }
        </div>
        <div class="borderHorizontal"></div>
    }
            

    <div id="EncounterButton" class="button">
        @if(Model.EncounterStarted)
        {
            <a href="@Url.Action("Index")"  class="button">End Encounter</a>
        }
        else
        {
            <a href="@Url.Action("StartEncounter")">Start Encounter</a>
        }
    </div>

</div>